@import "../../../styles/colors.less";

.cm-checkbox{
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  position: relative;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
  white-space: nowrap;
  vertical-align: middle;

  label{
    font-weight: 400;
    display: inline-block;
  }

  .cm-checkbox-outter{
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 1;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    -webkit-transition: all .3s;
    -o-transition: all .3s;
    transition: all .3s;
    margin: 0 4px;
    position: relative;
    -webkit-transition: all .3s;
    -o-transition: all .3s;
    transition: all .3s;

    &:hover{
      border-color: @color-blue;
    }
  }

  .cm-checkbox-inner{
    display: inline-block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-left: 0;
    border-top: 0;
    
    position: absolute;
    left: 5px;
    top: 2px;
    display: table;
    -webkit-transform: rotate(45deg) scale(0);
    -ms-transform: rotate(45deg) scale(0);
    transform: rotate(45deg) scale(0);

    -webkit-transition: all .3s;
    -o-transition: all .3s;
    transition: all .3s;
  }
  
  &.cm-checkbox-checked{
    .cm-checkbox-outter{
      border-color: @color-blue;
      background-color: @color-blue;
    }
    .cm-checkbox-inner{
      -webkit-transform: rotate(45deg) scale(1);
      -ms-transform: rotate(45deg) scale(1);
      transform: rotate(45deg) scale(1);
    }
  }

  &.disabled{
    color: rgba(0,0,0,0.3);
    .cm-checkbox-outter{
      border-color: #eee;
      background-color: #f4f4f4;
    }
    &.cm-checkbox-checked{
      .cm-checkbox-outter{
        border-color: lighten(@color-blue, 25%);
        background-color: lighten(@color-blue, 25%);
      }
    }
  }
  &.cm-radio.disabled {
    &.cm-checkbox-checked{
      .cm-checkbox-outter{
        border-color: lighten(@color-blue, 25%);
        background-color: transparent;
      }
    }
  }

  &.cm-checkbox-checked.cm-checkbox-indeterminate .cm-checkbox-inner {
    width: 8px;
    height: 2px;
    top: 6px;
    left: 3px;
    -webkit-transform: rotate(0) scale(1);
    -ms-transform: rotate(0) scale(1);
    transform: rotate(0) scale(1);
  }
}
.cm-checkbox-group{
  display: inline-block;
}
.cm-checkbox-group.cm-checkbox-group-stack,
.cm-radio-group.cm-radio-group-stack{
  .cm-checkbox{
    display: block;
  }
}

.cm-form-group-invalid .cm-checkbox-group,
.cm-form-group-invalid .cm-radio-group{
  .cm-checkbox {
    color: @color-danger;
  }
}
